<template>
	<view class="boxList">
		<view style="padding-top: 40rpx;" class="flex_r_between">
			<viwe class="qwe">“说你想说的哦”</viwe>
			<view class="asd">
				<image style="width: 56rpx;height: 56rpx;border-radius: 50%;" src="../../../static/homeImg/userImg.png" mode=""></image>
			</view>
		</view>
		<view class="zxc">
			<textarea class="" type="text" auto-height @input="content" @confirm="confirm"
			 v-model="commentValue" maxlength="300" placeholder="请点击这里发表健康、乐观的评论哦。" />
			</view>
		
		<view class="fgh">
			<view class="cvb">
				{{commentValueLen}}/300
			</view>
			<view class="tijiao" :class="{bgc_DB1B22:commentValueLen!==0?true:false}" @click="submit">
				提交
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				commentValue: '',
				commentValueLen:0,
				cInput:false,
				comment_id:0,
			};
		},
		onLoad(option) {
			this.id=option.article_id
			this.comment_id=option.comment_id
		},
		methods:{
			submit(){
				this.$request('/app/article/comment','post',{
					access_token:uni.getStorageSync('access_token').replace(/^\"|\"$/g,''),
					article_id:this.id,
					comment:this.commentValue,
					comment_id:this.comment_id
				}).then(res=>{
					uni.showToast({
						title:res.message,
						duration:2000,
						icon:'none',
						success: function(){
							setTimeout(()=>{
								uni.navigateBack()
							},2000)
						}
					})
				})
			},
			content(e) {
				console.log(e)
				this.commentValueLen = this.commentValue.length;
			},
			confirm(){
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import url("@/static/css/flex.css");
	.fgh{
		position: fixed;
		bottom: 0;
		height: 100rpx;
		background: #FFFFFF;
		border-top: 1px solid #DDDDDD;
		.tijiao{
			width: 690rpx;
			height: 70rpx;
			background: #FEBFC1;
			border-radius: 36rpx;
			margin: 14rpx auto;
			font-size: 28rpx;
			font-family: PingFangSC-Semibold, PingFang SC;
			font-weight: 600;
			color: #FFFFFF;
			line-height: 70rpx;
			text-align: center;

		}
		.bgc_DB1B22{
			background-color: #DB1B22;
		}
		.cvb{
			position: fixed;
			right: 30rpx;
			bottom: 118rpx;
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #999999;

		}
	}
	.boxList {
		width: 100%;
		height: auto;
		padding: 0 30rpx;
		box-sizing: border-box;
		border-top: 1px solid #D1D1D3;
	}
	.qwe {
		font-size: 40rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #333333;

	}
	.asd{
		width: 56rpx;height: 56rpx;border-radius: 50%;
		overflow: hidden;
	}
	.zxc{
		padding: 30rpx 0;
		height: auto;
		textarea{
			width: 100%;
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #333333;
			&:placeholder{
				color: #999999;
			}
		}
	}
</style>
